//
//  HMXContentCell.m
//  音乐播放器
//
//  Created by apple on 16/7/17.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "HMXContentCell.h"
#import "HMXMusicCell.h"
#import "HMXCommentCell.h"
#import "HMXHotLrcView.h"
#import "HMXHotCommentView.h"

@interface HMXContentCell ()

@property(nonatomic,strong)HMXMusicCell * pictureCell;
@property(nonatomic,strong)HMXCommentCell * commentCell;
@property(nonatomic,strong)HMXHotLrcView * hotLrcView;
@property(nonatomic,strong)HMXHotCommentView * hotCommentView;

@end

@implementation HMXContentCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{

    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        //取消cell的选中样式
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        HMXMusicCell * pictureCell = [HMXMusicCell viewFromNib];
        [self.contentView addSubview:pictureCell];
        self.pictureCell = pictureCell;
        
        HMXHotLrcView * hotLrcView = [HMXHotLrcView viewFromXib];
        [self.contentView addSubview:hotLrcView];
        self.hotLrcView = hotLrcView;
        
        HMXCommentCell * commentCell = [HMXCommentCell viewFromNib];
        [self.contentView addSubview:commentCell];
        self.commentCell = commentCell;
        
        HMXHotCommentView * hotCommentView = [HMXHotCommentView viewFromXib];
        [self.contentView addSubview:hotCommentView];
        self.hotCommentView = hotCommentView;
        
    }
    
    return self;
}

-(void)setFrame:(CGRect)frame
{
    frame.origin.y += 10;
    frame.size.height -= 10;
    [super setFrame:frame];
}

-(void)setVm:(musicViewModel *)vm{

    _vm = vm;
    self.pictureCell.item = vm.item;
    self.pictureCell.frame = vm.musicViewFrame;
    
    self.hotLrcView.item = vm.item;
    self.hotLrcView.frame = vm.bottomViewFrame;
    
    self.commentCell.item = vm.item;
    self.commentCell.frame = vm.commentViewFrame;
    
    self.hotCommentView.item = vm.item;
    self.hotCommentView.frame = vm.hotCommentViewFrame;
}


@end
